//
//  ViewController.m
//  UI05_触摸_手势
//
//  Created by aaaaaa on 16/6/12.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "ViewController.h"
#import "CustomUIView.h"
#import "GestureUIImageView.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self creatCustomUIView];
    [self createGestureView];
}

#pragma mark - 触摸
- (void)creatCustomUIView{
 
    CustomUIView *custom = [[CustomUIView alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
    custom.backgroundColor = [UIColor redColor];
    [self.view addSubview:custom];
    [custom release];
    
}

#pragma mark - 响应链
/*
 * 1.检测
     硬件 -> UIApplication -> 主窗口 -> 根视图控制器 -> 根视图（直到找到触摸到最上面的视图）
 * 2.响应(和检测相反)
     其他视图 -> 根视图 -> 视图控制器 -> 主窗口 -> UIApplication
     (如果在响应的过程当中一直都没有找到响应方法，触摸无效)
 */

#pragma mark - 手势
- (void)createGestureView {
    NSString *path = [[NSBundle mainBundle] pathForResource:@"image" ofType:@"jpg"];
    GestureUIImageView *gesture = [[GestureUIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:path] withFrame:CGRectMake(100, 300, 220, 167)];
    [self.view addSubview:gesture];
    [gesture release];
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
